<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Validate document against XSD</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="xmlreader.setrelaxngschemasource.html">« XMLReader::setRelaxNGSchemaSource</a></li>
      <li style="float: right;"><a href="xmlreader.xml.html">XMLReader::XML »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.xmlreader.html">XMLReader</a></li>
    <li>Validate document against XSD</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="xmlreader.setschema" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">XMLReader::setSchema</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">XMLReader::setSchema</span> &mdash; <span class="dc-title">Validate document against XSD</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-xmlreader.setschema-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>XMLReader::setSchema</strong></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$filename</code></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Use W3C XSD schema to validate the document as it is processed. Activation
   is only possible before the first Read().
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-xmlreader.setschema-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">filename</code></dt>

     <dd>

      <p class="para">
       The filename of the XSD schema.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-xmlreader.setschema-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-xmlreader.setschema-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   Issues <strong><code>E_WARNING</code></strong> if libxml was built without schema
   support, the schema contains errors or if
   <span class="function"><a href="xmlreader.read.html" class="function">XMLReader::read()</a></span> has already been called.
  </p>
 </div>

 
 
 
 <div class="refsect1 notes" id="refsect1-xmlreader.setschema-notes">
  <h3 class="title">注释</h3>
  <div class="caution"><strong class="caution">警告</strong><p class="para">此函数仅在 PHP 与 libxml 20620 或以上版本编译时可用。</p></div>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-xmlreader.setschema-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="xmlreader.setrelaxngschema.html" class="methodname" rel="rdfs-seeAlso">XMLReader::setRelaxNGSchema()</a> - Set the filename or URI for a RelaxNG Schema</span></li>
    <li class="member"><span class="methodname"><a href="xmlreader.setrelaxngschemasource.html" class="methodname" rel="rdfs-seeAlso">XMLReader::setRelaxNGSchemaSource()</a> - Set the data containing a RelaxNG Schema</span></li>
    <li class="member"><span class="methodname"><a href="xmlreader.isvalid.html" class="methodname" rel="rdfs-seeAlso">XMLReader::isValid()</a> - Indicates if the parsed document is valid</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>